﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Test.aspx.cs" Inherits="Sharp.Web.Test" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
        <link type="text/css" rel="stylesheet" href="/extjs/resources/ext_theme_neptune/ext-theme-neptune-all-embedded-css/ext.axd?v=1930"  />
    <link type="text/css" rel="stylesheet" href="/extnet/resources/css/extnet-all-embedded-css/ext.axd?v=1930"  />
    <script type="text/javascript" src="/extjs/ext-all-js/ext.axd?v=1930"></script>
    <script type="text/javascript" src="/extjs/ext-theme-neptune-js/ext.axd?v=1930"></script>
    <script type="text/javascript" src="/extnet/extnet-all-js/ext.axd?v=1930"></script>
    <script type="text/javascript" src="/extnet/locale/ext-lang-zh-CN-js/ext.axd?v=1930"></script>

    <script type="text/javascript" src="/ux/tabclosemenu/tabclosemenu-js/ext.axd?v=1930"></script>

    <script type="text/javascript">

        var test = {
            store: {
                type: "tree",
                proxy: {
                    type: "ajax",
                    reader: {
                        type: "json"
                    },
                    url: "/Org/GetData",
                    json: true
                },
                root: {
                    id: "Root"
                }
            },
            border: false,
            xtype: "treepanel",
            autoScroll: true,
            tbar: {
                xtype: "toolbar",
                items: [{
                    handler: function (item, e) {
                        OnModuleOperation(this, '/Org/Details');
                    },
                    text: "浏览"
                },
                {
                    handler: function (item, e) {
                        OnModuleOperation(this, '/Org/Create', {
                            ShowOnly: true
                        });
                    },
                    text: "新增"
                },
                {
                    handler: function (item, e) {
                        OnModuleOperation(this, '/Org/Edit');
                    },
                    text: "修改"
                },
                {
                    handler: function (item, e) {
                        OnModuleOperation(this, '/Org/Delete', {
                            IsAjax: true
                        });
                    },
                    text: "删除"
                },
                {
                    xtype: "tbfill"
                },
                {
                    id: "id91eb25e2bf5f3e0",
                    width: 300,
                    xtype: "TextField",
                    fieldLabel: "搜索",
                    labelWidth: 50,
                    triggersConfig: [{
                        hideTrigger: true,
                        iconCls: Ext.form.field.Trigger.getIcon("Clear")
                    },
                    {
                        iconCls: Ext.form.field.Trigger.getIcon("Search")
                    }],
                    listeners: {
                        triggerclick: {
                            fn: searchFieldTriggerClick
                        }
                    }
                }]
            },
            columns: {
                items: [{
                    width: 200,
                    xtype: "treecolumn",
                    dataIndex: "text",
                    text: "名称"
                },
                {
                    width: 100,
                    locked: false,
                    dataIndex: "code",
                    sortable: true,
                    text: "编码",
                    wrap: false
                },
                {
                    width: 200,
                    locked: false,
                    dataIndex: "orgPath",
                    sortable: true,
                    text: "组织",
                    wrap: false
                },
                {
                    width: 100,
                    xtype: "numbercolumn",
                    locked: false,
                    dataIndex: "maxHeadcount",
                    sortable: true,
                    text: "编制",
                    wrap: false
                },
                {
                    width: 100,
                    xtype: "numbercolumn",
                    locked: false,
                    dataIndex: "currentHeadcount",
                    sortable: true,
                    text: "当前编制",
                    wrap: false
                }]
            },
            sortableColumns: false,
            selModel: Ext.create("Ext.selection.CheckboxModel", {
                selType: "checkboxmodel"
            }),
            viewConfig: {
                plugins: [{
                    ptype: "treeviewdragdrop",
                    allowLeafDrop: true
                }],
                xtype: "treeview",
                listeners: {
                    drop: {
                        fn: dropItem
                    }
                }
            },
            animate: false,
            folderSort: false,
            rootVisible: false,
            mode: "remote"
        };
    </script>
    
    <script type="text/javascript">var idCPPopedom3 = Ext.create('Ext.tree.Panel', {
id: 'idCPPopedom3', loadMask: true, enableDD: true, animate: true, autoScroll: true, containerScroll: true, DropHanaleApi: '/api/Permission/MoveOrSort', rootVisible: true, plugins: [{
    ptype: 'bufferedrenderer'
}], border: false, 
    multiSelect: true, columnLines: true, columns: [
{ text: '权限名称', xtype: 'treecolumn', width: 250, dataIndex: 'Item.Title' }, { text: '权限', dataIndex: 'Item.CategoryText' }, { text: '权限编码', dataIndex: 'Item.Category' }, { text: '代码', width: 180, dataIndex: 'Item.Code' }, { text: '标识', width: 276, dataIndex: 'Item.Id' }],

    viewConfig: {
    plugins: { ptype: 'treeviewdragdrop', appendOnly: false }
    , listeners: { drop: dropItem, beforedrop: beforedropItem }
}
, listeners: {
    load: function () { idCPPopedom3.expandAll(); }
}
, listeners: {
    added: function (grid) {
        BindPagingStore(grid)
    }
, checkchange: function (node, checked) {

    treeclick(node, checked);
    Ext.Ajax.request({
        url: '/portalmodules/popedom/popedom.aspx?cmd=ChangeChecked',
        params: {
            nodedata: JSON.stringify(node.raw),
            checked: checked,
            autoSelect: true
        },
        success: function (response) {
            var result = Ext.JSON.decode(response.responseText);
            if (result.Err.length > 0) {
                Tip('提示', result.Err);
            } else {
                Tip('提示', result.Message);
            }
        },
        failure: function (response, opts) {
            Tip('提醒', '选择状态保存失败');
        }
    });
}
}
});
        idCPPopedom3.on('itemcontextmenu', function (view, record, item, index, e) {
            e.preventDefault();  //屏蔽默认右键菜单
            PopedomMenu.NodeItem = item;
            PopedomMenu.NodeRecord = record;
            PopedomMenu.showAt(e.getXY());
        });
        var idCPPopedom3_panel = new CEMS.ModuleStyleA({
            title: '',
            moduleId: idCPPopedom3
        });
        idCPPopedom3_panel.MainPanel().add(idCPPopedom3);
        idCPPopedom3_panel.Toolbar().add([{
            xtype: 'splitbutton', text: '导出', menu: {
                items: [
                                { text: '导出到<b> Excel </b>', Grid: idCPPopedom3, handler: ExportToExcel }]
            }
        }]); var modulePanel = G.Modules();
        var tab = modulePanel.items.getAt(1);
        tab.add(idCPPopedom3_panel);
        tab.ModuleID = 'CPPopedom';
        tab.contentPanel = idCPPopedom3_panel;
        tab.hasPrint = true;
        tab.queryPanel = idCPPopedom3_query =
Ext.create('Ext.CEMS.QueryPanel', {
    IDPrefix: 'idCPPopedom3', defaultUrl: '/portalmodules/popedom/popedom.aspx?ModuleID=CPPopedom&cmd=GetData',
    fieldDefaults: {
        labelAlign: 'right',
        labelWidth: 100
    },
    items: [{ fieldLabel: '权限名称', name: 'AvailablePermission_Item.Title' }, { fieldLabel: '权限', name: 'AvailablePermission_Item.CategoryText' }, {
        xtype: "combobox"
, fieldLabel: "权限编码"
, value: "--全部--"
, displayField: "Name"
, valueField: "Code"
, queryMode: "local"
, name: "AvailablePermission_Item.Category"
, TimesTheWidth: 1
, labelSeparator: "："
, labelAlign: "right"
, typeFullName: "ComboBoxField"
, width: 1
, height: 22
, listeners: { change: DirectQuery }
, store: {
    fields: ['Code', 'Name'],
    data:
    []
}
    }, { fieldLabel: '代码', name: 'AvailablePermission_Item.Code' }, { fieldLabel: '标识', name: 'AvailablePermission_Item.Id' }]
}); idCPPopedom3_query.SetStore(Ext.getCmp('idCPPopedom3').store);
        var queryPanel = G.Query();
        for (var i = 0; i < queryPanel.items.getCount() ; i++)
            queryPanel.items.getAt(i).setVisible(false);
        queryPanel.add(modulePanel.items.getAt(1).queryPanel);
        modulePanel.items.getAt(1).DoActivate();
        HideLoading();
        idCPPopedom3.on('itemclick', OnModuleGridItemClick); HideLoading();</script>
</head>
<body>
    <form id="form1" runat="server">
        <div>
        </div>
    </form>
</body>
</html>
